package com.windy.common.context;

import com.windy.common.header.Headers;

/**
 * Created by liyufeng on 2022/5/8
 */
public class HeaderContextHolder {
    private static volatile ContextHolderStrategy<Headers> strategy = new ThreadLocalContextHolderStrategy<Headers>();

    public void setStrategy(ContextHolderStrategy<Headers> strategy) {
        HeaderContextHolder.strategy = strategy;
    }

    public static Headers getHeader(){
        return strategy.getContext();
    }

    public static void setHeader(Headers transmitHeader){
        strategy.setContext(transmitHeader);
    }

    public static void clear(){
        strategy.clearContext();
    }


}
